import React from "react";
import { Switch, Route, Redirect } from "react-router-dom";

let Login=React.lazy(()=>import("./pages/Login/Login"))
let List=React.lazy(()=>import("./pages/List/List"))
let Register=React.lazy(()=>import("./pages/Register/Register"))
let Detail=React.lazy(()=>import("./pages/Detail/Detail"))
let Search=React.lazy(()=>import("./pages/Search/Search"))
let Home=React.lazy(()=>import("./pages/Home/Home"))
export default function App() {
  return (
    <React.Suspense fallback={<div>loadiing...</div>}>
      <Switch>
        <Route path="/login" component={Login}></Route>
        <Route path="/register" component={Register}></Route>
        <Route path="/index" component={Home}></Route>
        <Route path="/list" component={List}></Route>
        <Route path="/detail/:id/:type" component={Detail}></Route>
        <Route path="/search" component={Search}></Route>
        <Redirect to="/login"></Redirect>
      </Switch>
    </React.Suspense>
  );
}
